import { http } from '@/server'
import type { HttpResponsePending } from '@/server/interface'
import type { CourseDetail } from './detail/interface'

/** 获取课程列表 */
export const fetchCourseList = (): HttpResponsePending<Record<string, CourseDetail>> =>
    http.get(`/engineer/video/video-online`)

/** 获取课程详情 */
export const fetchCourseDetail = async (id: number): Promise<CourseDetail> => {
    const { data } = await fetchCourseList()
    const courseList = data
    const courseDetail = courseList[id]
    return courseDetail
}
